package edu.pku.sei.transformation.mtparser;

import lpg.runtime.*;

/**
 *<em>
 *<li>Rule 3:  RuleSemantics ::= BasicRuleSemantics
 *</em>
 *<p>
 *<b>
 *<li>Rule 2:  RuleSemantics ::= RuleSemantics BasicRuleSemantics
 *</b>
 */
public class RuleSemantics extends Ast implements IRuleSemantics
{
    private IRuleSemantics _RuleSemantics;
    private BasicRuleSemantics _BasicRuleSemantics;

    public IRuleSemantics getRuleSemantics() { return _RuleSemantics; }
    public BasicRuleSemantics getBasicRuleSemantics() { return _BasicRuleSemantics; }

    public RuleSemantics(IToken leftIToken, IToken rightIToken,
                         IRuleSemantics _RuleSemantics,
                         BasicRuleSemantics _BasicRuleSemantics)
    {
        super(leftIToken, rightIToken);

        this._RuleSemantics = _RuleSemantics;
        this._BasicRuleSemantics = _BasicRuleSemantics;
        initialize();
    }

    public boolean equals(Object o)
    {
        if (o == this) return true;
        if (! (o instanceof RuleSemantics)) return false;
        if (! super.equals(o)) return false;
        RuleSemantics other = (RuleSemantics) o;
        if (! _RuleSemantics.equals(other._RuleSemantics)) return false;
        if (! _BasicRuleSemantics.equals(other._BasicRuleSemantics)) return false;
        return true;
    }

    public int hashCode()
    {
        int hash = super.hashCode();
        hash = hash * 31 + (_RuleSemantics.hashCode());
        hash = hash * 31 + (_BasicRuleSemantics.hashCode());
        return hash;
    }

    public void accept(Visitor v) { v.visit(this); }
    public void accept(ArgumentVisitor v, Object o) { v.visit(this, o); }
    public Object accept(ResultVisitor v) { return v.visit(this); }
    public Object accept(ResultArgumentVisitor v, Object o) { return v.visit(this, o); }
}


